#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstdint>
#include <cstring>

using namespace std;

class Solution {
public:
    bool isAnagram(string s, string t) {
        int count[26] = {0};
        if (s.length() != t.length()){
            return false;
        }
        for (int i = 0; i < s.length(); i++){
            count[s[i]-'a']++;
            count[t[i]-'a']--;
        }
        for (int i = 0; i < 26; i++){
            if (count[i]){
                return false;
            }
        }
        return true;
    }
};

int main(void)
{
    string s = "anagrama";
    string t = "nagaram";
    bool result = false;
    Solution su;
    result = su.isAnagram(s, t);
    printf("result is %d\r\n", result);
    return 0;
}
